var resultJson = require('../result-json');

module.exports = function(app){
    app.get('/', (req, res) => {
        res.send('Welcome to liuhaojie-server~');
    });

    app.use('/utils', require('./utils'));

    app.use('/house', require('./house'));

    // 404 page
    app.use(function (req, res) {
        if (!res.headersSent) {
            res.send(resultJson(4004));
        }
    });

    // error page
    app.use(function (err, req, res, next) {
        res.send(resultJson(5000, err));
    });
}